package com.common.dao.util;

/**
 * Class used for search queries.
 */
public class Criteria {
	
	private String title;
	private String value;
	private QueryOperation operation;
	private boolean comma;
	
	public Criteria() {}
	
	/**
	 * @param title is the name of the column
	 * @param value is the value of the column
	 * @param operation is the comparation operation of the column
	 * @param comma marks if the value is a String/Text or not
	 */
	public Criteria(String title, String value, QueryOperation operation, boolean comma) {
		this.title = title;
		this.value = value;
		this.operation = operation;
		this.comma = comma;
	}
	
	/**
	 * @param title is the name of the column
	 * @param value is the value of the column, converted to String
	 * @param operation is the comparation operation of the column
	 * @param comma marks if the value is a String/Text or not
	 */
	public Criteria(String title, Object value, QueryOperation operation, boolean comma) {
		this.title = title;
		this.value = value.toString();
		this.operation = operation;
		this.comma = comma;
	}
	
	public void setTitle(String title) {
		this.title = title;
	}
	
	public String getTitle() {
		return title;
	}
	
	public void setValue(Object value) {
		this.value = value.toString();
	}
	
	public void setValue(String value) {
		this.value = value;
	}
	
	public String getValue() {
		return value;
	}

	public boolean hasComma() {
		return comma;
	}

	public void setComma(boolean comma) {
		this.comma = comma;
	}

	public QueryOperation getOperation() {
		return operation;
	}

	public void setOperation(QueryOperation operation) {
		this.operation = operation;
	}
}
